CMS.LoginWin=function(){
	var win=new Ext.Window({
		id:"LoginWin",
		title:'用户登录',
		width:400,
		collapsible:false,
		closable:false,
		resizable:false,
		shadow:true,
		shadowOffset:10,
		defaults:{
			border:false
		},
		buttonAlign:'center',
		items:[
			{
            defaults:{xtype:"form",layout:"form",anchor:"100%",autoHeight:true,border:true,frame:false},columnWidth:0.2,
            items:[{
                autoHeight:true,defaults:{anchor:"-10"},bodyStyle : "background:#DFE8F6",
                html:'<img id ="CompanyLogo" src="share/images/login/logo.png" height="48"/>'
            }]
        },
			loginForm = new Ext.FormPanel({
				bodyStyle:'padding-top:20px',
				defaultType:'textfield',
				labelAlign:'right',
				height:100,
				frame:true,
				defaults:{
					allowBlank:false,
					autowidth:true,
					width:210
				},
				items:[{
					xtype:'textfield',
					fieldLabel:'用户名',
					cls:'text-user',
					name:'username',
					blankText:'用户名不能为空！'
				},
				{
					xtype:'textfield',
					fieldLabel:'密　码',
					cls:'text-lock',
					name:'password',
					inputType:'password',
					blankText:'密码不能为空',
					enableKeyEvents:true,
     				initEvents:function(){
				       var keyPress=function(e){
				          if(e.getKey()==e.ENTER){
				             OK();
				          }
				        };
				        this.el.on("keypress",keyPress,this);
				    }
				}]
			})
			],
			buttons:[{
				text:"登录",
				iconCls:"btn-login",
				id:'login',
				type:"submit",
				handler:OK
			},{
				text:"重置",
				id:'reset',
				iconCls:"btn-login-reset",
				type:"submit",
				handler:function(){
					loginForm.form.reset();
				}
			}
			]
		});
		function OK(){
			if (loginForm.form.isValid()) {
	    		loginForm.getForm().submit({
					method: 'post',
					waitTitle: '提交信息',
					waitMsg: '连接中...',
					url: CONTEXT_PATH + '/login/',
					success: function(form, response) {
						responseCallBack(response.result);
					},
					failure: function(form, response) {
						responseCallBack(response.result);
					}
				});
			}
		}
		function responseCallBack(result) {
			if(result==null){
				window.location = CONTEXT_PATH + "/adminToLogin";
			}
			if(result['loginstatus'] == 0) {
				showTip('提示' , result['msg']);
			}else {
				var beforeTime = new Date();
				beforeTime.setTime(beforeTime - 10000);
				document.cookie = "loginConvertName=no; expires=" + beforeTime.toGMTString();
				var cookieTime = new Date();
				cookieTime.setTime(cookieTime.getTime() + 24*60*60*1000);
				document.cookie = result['cookieName'] + "=" + escape(result['cookieValue']) + ";expires=" + cookieTime.toGMTString();
				window.location = CONTEXT_PATH + "/adminToLogin";
			}
		}
	return win;
};